<%-- 
    Document   : portfolio
    Created on : Jan 25, 2013, 12:20:59 AM
    Author     : ritu
--%>

<%@page import="java.io.FileReader"%>
<%@page import="java.io.File"%>
<%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.net.URL"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="connection.jsp" %>

<%
        String sr=null;
    if(session.getAttribute("sr")==null){
        response.sendRedirect("index.jsp?msg=Please,Login First");
      //  out.print("<script type='text/javascript'>alert('asfa');</script>");
    }
    else
        sr=session.getAttribute("sr").toString();
%>
<%!
URL url;
BufferedReader br=null;
%>      

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Portfolio</title>
        <link rel="stylesheet" type="text/css" href="css/theme.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        
        <script>
            var StyleFile = "theme" + document.cookie.charAt(6) + ".css";
            document.writeln('<link rel="stylesheet" type="text/css" href="css/' + StyleFile + '">');
        </script>
        <!--[if IE]>
        <link rel="stylesheet" type="text/css" href="css/ie-sucks.css" />
        <![endif]-->
        
        <!-- Dialogue box -->
        <link rel="stylesheet" href="js/jquery-ui-1.8.23.custom/development-bundle/themes/base/jquery.ui.all.css">
            <script src="js/jquery-ui-1.8.23.custom/js/jquery-1.7.2.min.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/external/jquery.bgiframe-2.1.2.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.core.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.widget.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.mouse.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.button.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.draggable.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.position.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.resizable.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.dialog.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.datepicker.js"></script>
	<script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.effects.core.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.autocomplete.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.accordion.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.ui.tooltip.js"></script>
        <script src="js/jquery-ui-1.8.23.custom/development-bundle/ui/jquery.effects.explode.js"></script>
        
        <style type="text/css">
            table{
                border-collapse: separate;
                border: 0px;
                font-size: 14px;
            }
            #box h3{
                font-size: 16px;
            }
            
        </style>
       <!-- <link rel="stylesheet" href="js/jquery-ui-1.8.23.custom/development-bundle/demos/demos.css">-->
	<style>
		label, input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h1 { font-size: 1.2em; margin: .6em 0; }
		div#users-contain { width: 350px; margin: 20px 0; }
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
		.ui-dialog .ui-state-error { padding: .3em; }
		.validateTips { border: 1px solid transparent; padding: 0.3em; }
	</style>       
        <script>
       
	$(function() {
           
                
		$( "#date" ).datepicker({
			changeMonth: true,
			changeYear: true,
                        dateFormat: "yy-mm-dd"
		});
                
                $( "#date1" ).datepicker({
			changeMonth: true,
			changeYear: true,
                        dateFormat: "yy-mm-dd"
		});
                
          
		
                            $.getJSON("1.jsp", function(data){
                                var tags=new Array();
                                $.each(data, function(com,ticker){
                                    tags.push(ticker.name);
                                });
                                           
                                $( "#com" ).autocomplete({
                                    source:tags
                                }); 
                                
                                 $( "#com_name1" ).autocomplete({
                                    source:tags
                                }); 
                            });
                            
                
                $( "#sidebar" ).accordion({
			//collapsible: true,
                        autoHeight:false,
                        event:"mouseover"
		});
                
                $("#del_stk").live('click',function(){
                    var id=$(this).attr("dir").toString();//alert(id);
                    $("input#val").attr("value",id);
                   // alert($("input#val").attr("value"));
                    $( "#del_stk_dlg" ).dialog( "open" );
                    
                });
               
				
		
                  
                $( "#del_stk_dlg" ).dialog({
			autoOpen: false,
			height: 200,
                        width: 350,
                        show:"explode",
                        hide: "explode",
                        modal:true,
                        buttons: {
				"Delete": function() {
                                   // $(this).dialog("close");
                                    //$("#del_form").submit();
                                    $("#frm").submit();
                                    $( this ).dialog( "close" );			
				},
				Cancel: function() {
                                        
					$( this ).dialog( "close" );
				}
			}
		});
	});
	</script>
	<script>
	$(function() {
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
		var com_name = $( "#com" ), 
			quanti = $( "#quanti" ),
                        price = $( "#price" ),
                        port = $("#port"),
                        port1= $("#port1"),
                        date = $("#date"),
                        com_name1 =$("#com_name1"),
                        quanti1 = $("#quanti1"),
                        price1 = $("#price1"),
                        date1 = $("#date1"),
			allFields = $( [] ).add( com_name ).add( quanti ).add( price ).add( port ).add( port1 ).add(date).add( com_name1 ).add( quanti1 ).add( price1 ).add(date1),
			tips = $( ".validateTips" );
                       
		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}

		function checkLength( o, n, min, max ) {
                       // alert(o.val());
			if ( o.val().length > max || o.val().length < min ) {
				o.addClass( "ui-state-error" );
                                
				updateTips( "Length of " + n + " must be between " +
					min + " and " + max + "." );
				return false;
			} else {
				return true;
			}
		}
                
                function checkDate( o ) {
                    if ( o.toString().length < 1 ) {
				o.addClass( "ui-state-error" );
				updateTips( "Date field can't be blank" );
				return false;
			} else {
				return true;
			}
		}

		function checkRegexp( o, regexp, n ) {
			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass( "ui-state-error" );
				updateTips( n );
				return false;
			} else {
				return true;
			}
		}
		
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 400,
                        show:"explode",
                        hide: "explode",
			width: 350,
			modal: true,
			buttons: {
				"Add a Stock": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );
                                        
					bValid = bValid && checkLength( com_name, "Company Name", 3, 16 );
					//bValid = bValid && checkLength( ticker, "Ticker Symbol", 3, 10 );
					

					bValid = bValid && checkRegexp( com_name, /^[a-z]([0-9a-z_])+([\.]([0-9a-z_]+))?$/i, "Company Name may consist of a-z, 0-9, underscores, begin with a letter." );
					
                                        bValid = bValid && checkRegexp( quanti, /^[0-9\ ]+$/, "Quantity should be a number only." );
                                        // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/ticker_address_validation/
                                        bValid = bValid && checkRegexp( price, /^[0-9\ ]+([\.]([0-9]+))?$/, "Price should be a number only." );

					bValid = bValid && checkDate(date);
                                        
                                       // alert(date.toString());
                                        if ( bValid ) {
						$("#form1").submit();
						$( this ).dialog( "close" );                                                
					}
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});

		$("#create")
			.button()
			.click(function() {
				$( "#dialog-form" ).dialog( "open" );
                        
			});
                        
                $("#del_port")
			.button()
			.click(function() {
				$( "#del" ).dialog( "open" );
			});
                  
                $( "#del" ).dialog({
			autoOpen: false,
			height: 200,
                        width: 350,
                        show:"explode",
                        hide: "explode",
                        modal:true,
                        buttons: {
				"Delete": function() {
                                    $(this).dialog("close");
                                    $("#del_form").submit();
                                    
                                    			
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			}
		});  
                $( "#dialog-port" ).dialog({
			autoOpen: false,
			height: 300,
                        show:"explode",
                        hide: "explode",
			width: 350,
			modal: true,
			buttons: {
				"Add a Portfolio": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );

					bValid = bValid && checkLength( port, 'Portfolio Name', 3, 16 );
					
					

					bValid = bValid && checkRegexp( port, /^[a-z]([0-9a-z_])+$/i, "Company Name may consist of a-z, 0-9, underscores, begin with a letter." );
					
                                        
					if ( bValid ) {
						
                                                $( this ).dialog( "close" );                                                
                                                $("#add_form").submit();  
                                                
					}
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
                $("#createport").button()
                .click(function(){
                    $("#dialog-port").dialog("open");
                });
                
                $( "#dialog-port-rename" ).dialog({
			autoOpen: false,
			height: 300,
                        show:"explode",
                        hide: "explode",
			width: 350,
			modal: true,
			buttons: {
				"Rename": function() {
					var bValid = true;
					allFields.removeClass( "ui-state-error" );

					bValid = bValid && checkLength( port1, "Portfolio Name", 3, 16 );
					//bValid = bValid && checkLength( ticker, "Ticker Symbol", 3, 10 );
					

					bValid = bValid && checkRegexp( port1, /^[a-z]([0-9a-z_])+$/i, "Portfolio Name may consist of a-z, 0-9, underscores, begin with a letter." );
					
                                        
					if ( bValid ) {
						
						$( this ).dialog( "close" );                                                
                                                $("#renm_form").submit();
					}
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
                $("#rename").button()
                .click(function(){
                    $("#dialog-port-rename").dialog("open");
                });
                
                $("#edit_stock").live('click',function(){
                    var id=$(this).attr("dir").toString();//alert(id);
                 
                    $.getJSON("stock_ajax.jsp?id="+id+"",function(data){
                           $("input#com_name1").attr("value",data.ticker);
                           $("input#quanti1").attr("value",data.qty);
                           $("input#price1").attr("value",data.price);
                           $("input#date1").attr("value",data.date);
                           $("#hid1").attr("value",id); 
                                
                    });

                    $( "#a" ).dialog( "open" );
                    
                });
                $( "#a" ).dialog({
			autoOpen: false,
			height: 400,
                        show:"explode",
                        hide: "explode",
			width: 350,
			modal: true,
			buttons: {
				"Edit Stock": function() {
                                    
                                       
                                       // alert(com.val());
					var bValid = true;
					allFields.removeClass( "ui-state-error" );
                                        
					bValid = bValid && checkLength( com_name1, "Company Name", 3, 16 );
					//bValid = bValid && checkLength( ticker, "Ticker Symbol", 3, 10 );
					//if(bValid){alert("hi");}
                                        
					bValid = bValid && checkRegexp( com_name1, /^[a-z]([0-9a-z_])+([\.]([0-9a-z_]+))?$/i, "Company Name may consist of a-z, 0-9, underscores, begin with a letter." );
					
                                        bValid = bValid && checkRegexp( quanti1, /^[0-9\ ]+$/, "Quantity should be a number only." );
                                        // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/ticker_address_validation/
                                        bValid = bValid && checkRegexp( price1, /^[0-9\ ]+([\.]([0-9]+))?$/, "Price should be a number only." );

					bValid = bValid && checkDate(date);
                                        
                                       // alert(date.toString());
                                        if ( bValid ) {
						$("#edit_stk_dlg").submit();
						$( this ).dialog( "close" );                                                
					}
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});
                
                
	});
	</script>
    
            
    </head>
    
    <%  
        if(request.getParameter("msg")!=null)
        {
           out.print("<script type='text/javascript'>alert('Please select from Suggestion box');</script>");
        }
        
    %>

    <body>
         <div id="container">
             <div id="header">
                 <h2>Stock Market Website</h2>
                 <div id="topmenu">
                    <ul>
                         <li><a href="user_home.jsp">Dashboard</a></li>
                         <li class="current"><a href="portfolio.jsp">Portfolio</a></li>
                        <li><a href="charts.jsp">Charts</a></li>
                        <!--<li><a href="chatgroup_user.jsp">Chat Group</a></li>-->
                        <li><a href="experts_user.jsp">Experts</a></li>
                        <!--                    <li><a href="emails.jsp">Emails</a></li>-->
                    </ul>
                </div>
            </div>
            <div id="top-panel"><!-- Problem with submit button in this form -->
                         <form action="unknown" name="quoteform" >
                             <input type="text" placeholder="Get Quote" name="sym_nm" id="com_name" />
                             <input type="button" name="quoteformsub" value="Get Stock Value" />         
                         </form>
      </div>
            <%
             
             String pf_id=null;                   
                                if(request.getParameter("pid")==null){
                                     st=con.createStatement();
                                     rs=st.executeQuery("select pf_id from portfolio where u_id='"+sr+"' limit 1");
                                     while(rs.next()){
                                         pf_id=rs.getString(1);
                                     }
                                }
                                else{
                                    pf_id=request.getParameter("pid").toString();
                                   
                                }
            %>
			
            <div id="wrapper">
                <div id="content">
                    <div id="dialog-port" title="Add a Portfolio">
                        <p class="validateTips">All form fields are required.</p>

                        <form action="pf_update_back.jsp" id="add_form" method="post">
                        <fieldset>
                            <label for="com_name">Portfolio Name</label>
                            <input type="text" name="port" id="port" class="text ui-widget-content ui-corner-all" />
                            <input type="hidden" name="hid" value="add"/>
                            
                        </fieldset>
                        </form>
                    </div>
                    
                    
                    <div id="dialog-port-rename" title="Rename a Portfolio">
                        <p class="validateTips">All form fields are required.</p>

                        <form action="pf_update_back.jsp" id="renm_form" method="post">
                        <fieldset>
                            <label for="com_name">Portfolio Name</label>
                            <input type="text" name="port1" id="port1" value="<%
                                
                                st=con.createStatement();
                                rs=st.executeQuery("select pf_nm from portfolio where pf_id='"+pf_id+"'");
                                while(rs.next())
                                                                       {
                                    out.print(rs.getString(1));
                                }
                                %>" class="text ui-widget-content ui-corner-all" />
                                
                                <input type="hidden" id ="hid" name="hid" value="rename"/>   
                                <input type="hidden" id="pf" name="pf" value="<%=pf_id%>"/>   
                        </fieldset>
                        </form>
                    </div>
                
		<button id="createport" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
			<span class="ui-button-text">Add a Portfolio</span>
		</button>
                
                <button id="rename" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
                    	<span class="ui-button-text">Rename Portfolio</span>
		</button>
                    
                <button id="del_port" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
			<span class="ui-button-text">Delete Portfolio</span>
		</button>    
                            <div id="del">
                                <p>Are you sure you want to delete this portfolio?</p>
                                 <form action="pf_update_back.jsp" method="post" id="del_form">
                                    <input type="hidden" name="hid" value="del"/>
                                    <input type="hidden" name="pf" value="<%=pf_id%>"/>    
                                </form> 
                            </div>  
                                
                                <div id="del_stk_dlg">
                                    <p>Delete this stock?</p>
                                </div>   
                    <br>
                        <div id="a" title="Edit Portfolio">
                            <p class="validateTips">All form fields are required.</p>
                            <form action="pf_stock_back.jsp?op=update" method="POST" id="edit_stk_dlg">
                            <fieldset>
                                <label for="com_name">Company Name</label>
                                <input type="text" name="com_name" id="com_name1" class="text ui-widget-content ui-corner-all" title="Please select from the suggestion box"/>
                                <label for="quanti">Quantity</label>
                                <input type="text" name="quanti" id="quanti1"  class="text ui-widget-content ui-corner-all" />
                                <label for="price">Price</label>
                                <input type="text" name="price" id="price1"  class="text ui-widget-content ui-corner-all" />
                                <label for="date">Date</label>
                                <input type="text" name="date" id="date1" class="text ui-widget-content ui-corner-all" />
                                <input type="hidden" name="hid" id="hid1"/>
                                <input type="hidden" name="pf" value="<%=pf_id%>"/>    
                            </fieldset>
                
                
                            </form>   
                        </div> 
                        <form action='pf_stock_back.jsp?' id='frm'>
                            <input type='hidden' name='val' id="val"/>
                            <input type='hidden' name='op' value='del'/>
                        </form>
                    <div id="box">
                        <h3>
                        <%     
                               st=con.createStatement();
                                rs=st.executeQuery("select ticker from company,pf_detail where pf_detail.com_id=company.com_id and pf_id='"+pf_id+"'");
                                String sym="";
                                while(rs.next()){
                                    if(rs.isLast()){
                                       // sym=sym.concat("+");
                                        sym=sym.concat(rs.getString(1));                                        
                                    }
                                    
                                    else{
                                        
                                        sym=sym.concat(rs.getString(1));
                                        sym=sym.concat("+");
                                       // sym=sym.concat("+");
                                    }
                                        
                                    
                                }
                               
                                url=new URL("http://finance.yahoo.com/d/quotes.csv?s="+sym+"&f=l1");
                                br=new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
                             //  File f = new File("D:/project/web/quotes.csv");
                              // br = new BufferedReader(new FileReader(f));
                                 double last_price;
                                      
                                st = con.createStatement();
                                rs = st.executeQuery("select pf_nm from portfolio where pf_id='"+pf_id+"'" );
                            
                            while (rs.next()) {
                                out.print(rs.getString("pf_nm"));
                            %>
                        </h3>
                        <table>     
                            <thead>
                                <tr>
                                    <th><center><b>Company Name</b></center></th>
                                    <th><center><b>Buy Price</b></center></th>
                                    <th><center><b>Quantity</b></center></th>
                                    <th><center><b>Last Traded Price</b></center></th>
                                    <th><center><b>(Gain/Loss)/share</b></center></th>
                                    <th><center><b>Total Gain/Loss</b></center></th>
                                    <th><center><b>Date</b></center></th>
                                    <th><center><b>Operation</b></center></th>
                                </tr>
                            </thead>
                            <%
                                ResultSet rs1;
                                Statement st = con.createStatement();
                                
                                rs1 = st.executeQuery("select com_nm,ticker,buy_price,buy_qty,date,sr_no from company,pf_detail where pf_detail.com_id=company.com_id and pf_detail.pf_id='"+pf_id+"'");
                           
                              //   out.print(pf_id);
                                while (rs1.next()) {
                                    out.print("<tr>");

                                    out.print("<td>");

                                   // out.print("<a href='http://localhost:8080/compprof.jsp?ticker="+rs1.getString(2)+"'>"+rs1.getString("com_nm")+"</a>");

                                    out.print("<a href='compprof.jsp?ticker="+rs1.getString(2)+"'>"+rs1.getString("com_nm")+"</a>");

                                    out.print("</td>");

                                    out.print("<td>");

                                    out.print(Double.parseDouble(rs1.getString("buy_price")));

                                    out.print("</td>");

                                    out.print("<td>");
                                    out.print(rs1.getString("buy_qty"));
                                    out.print("</td>");
                                    
                                    out.print("<td>");
                                    out.print(last_price=Double.parseDouble(br.readLine().toString()));
                                    out.print("</td>");
                                                       
                                    out.print("<td>");
                                    out.print(last_price-Double.parseDouble(rs1.getString("buy_price").toString()));
                                    out.print("</td>");
                                    
                                    out.print("<td>");
                                    out.print((last_price-Double.parseDouble(rs1.getString("buy_price").toString()))*Integer.parseInt(rs1.getString("buy_qty")));
                                    out.print("</td>");
                                    
                                    out.print("<td>");
                                    out.print(rs1.getString("date"));
                                    out.print("</td>");
                                    
                                    out.print("<td>");
                                  //  out.print("<a id='edit_stock'>edit</a> <a id='del_stk' href='pf_stock_back.jsp?op=del&id="+rs1.getString(6)+"&pf="+pf_id+"'>delete</a>");
                                     out.print("<a id='edit_stock' href='#' dir='"+rs1.getString("sr_no")+"'>edit</a> <a id='del_stk' href='#' dir='"+rs1.getString(6)+"'>delete</a>");
                                     out.print("</td>");
                                    
                                    out.print("</tr>");
                                }
                                rs1.close();
                           %>
                           
                        </table>
                            <%  
                              }
                             
                               st.close();
                               rs.close();                               
                            %>
                    </div>
                     <div class="demo">

<div id="dialog-form" title="Add a Stock">
	<p class="validateTips">All form fields are required.</p>

        <form action="pf_update_back.jsp" id="form1" method="POST">
	<fieldset>
		<label for="com_name">Company Name</label>
		<input type="text" name="com_name" id="com" class="text ui-widget-content ui-corner-all" title="Please select from the suggestion box"/>
		<label for="quanti">Quantity</label>
		<input type="text" name="quanti" id="quanti" value="" class="text ui-widget-content ui-corner-all" />
                <label for="price">Price</label>
		<input type="text" name="price" id="price" value="" class="text ui-widget-content ui-corner-all" />
                <label for="date">Date</label>
		<input type="text" name="date" id="date" value="" class="text ui-widget-content ui-corner-all" />
                <input type="hidden" name="hid" id="hid" value="stock"/>
                <input type="hidden" name="pf" value="<%=pf_id%>"/>    
		</fieldset>
	</form>
</div>
<div id="box1"> 
                
            
                
        </div>                
                                                         
                             
<button id="create" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Add Stock</span>
</button>

</div><!-- End demo -->
                </div>
                
                <div id="sidebar">
  				
                    <li><h3><a href="#" class="house">Dashboard</a></h3>
                        <ul>   
                            <li><a href="logout.jsp" class="report">Logout</a></li>
                        </ul>
                    </li>   
                    
                                            
                  <li><h3><a href="#" class="user">My Portfolios</a></h3>
          				<ul>
                                            <%
                                            
                                            st=con.createStatement();
                                            rs=st.executeQuery("select * from portfolio where u_id='"+sr+"'");
                                            while(rs.next())
                                            {
                                                String s1=rs.getString("pf_id").toString();
                                                out.print("<li><a href='portfolio.jsp?pid="+s1+"' class='invoices'>");
                                                out.print(rs.getString("pf_nm"));
                                                out.print("</a></li>");
                                            }
                                            

                                             %>
                                            
                         
                        </ul>
                    </li>
				
          </div>
      </div>
        <div id="footer">
        <div id="styleswitcher">
            <ul>
                <li><a href="javascript: document.cookie='theme='; window.location.reload();" title="Default" id="defswitch">d</a></li>
                <li><a href="javascript: document.cookie='theme=1'; window.location.reload();" title="Blue" id="blueswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=2'; window.location.reload();" title="Green" id="greenswitch">g</a></li>
                <li><a href="javascript: document.cookie='theme=3'; window.location.reload();" title="Brown" id="brownswitch">b</a></li>
                <li><a href="javascript: document.cookie='theme=4'; window.location.reload();" title="Mix" id="mixswitch">m</a></li>
                <li><a href="javascript: document.cookie='theme=5'; window.location.reload();" title="Mix" id="defswitch">m</a></li>
            </ul>
        </div><br />

        </div>
</div>
</body>
</html>
            